//package com.zxy.ziems.server.mapper;
//
//import com.zxy.btp.mybatis.mapper.BtpBaseMapper;
//import com.zxy.ziems.server.domain.DeviceMeasureData;
//import com.zxy.ziems.server.energy.pojo.dto.DeviceMeasureDateDto;
//import org.apache.ibatis.annotations.Mapper;
//import org.apache.ibatis.annotations.Param;
//import org.apache.ibatis.annotations.Select;
//
//import java.time.LocalDateTime;
//import java.util.List;
//
//@Mapper
//public interface DeviceMeasureDataMapper extends BtpBaseMapper<DeviceMeasureData> {
//
//    @Select("<script>" +
//            "SELECT " +
//            "avg( tdm.measure_value * tcdp.multiple) as statistic," +
//            "${format}(tdm.measure_time) as dayStr " +
//            "FROM" +
//            " t_device_measure_data_history_${year} tdm" +
//            " left join t_classify_device_property tcdp ON tdm.device_id=tcdp.device_id" +
//            " WHERE" +
//            " tdm.measure_time BETWEEN #{start} " +
//            " AND #{end} " +
//            " AND tdm.device_id IN " +
//            " <foreach item='item' index='index' collection='deviceIds' open='(' separator=',' close=')'> #{item} </foreach> " +
//            " AND tdm.data_type_id = #{devicePropertyId} " +
//            "GROUP BY" +
//            " ${format}(tdm.measure_time)" +
//            "</script>")
//    List<DeviceMeasureDateDto> getAvg(@Param("year") int year, @Param("start") LocalDateTime start, @Param("end") LocalDateTime end,
//                                      @Param("deviceIds") List<String> deviceIds, @Param("devicePropertyId") String devicePropertyId,
//                                      @Param("format") String format);
//
//    @Select("<script>" +
//            "SELECT " +
//            "sum( tdm.increment_value * tcdp.multiple) as statistic," +
//            "${format}(tdm.measure_time) as dayStr " +
//            "FROM" +
//            " t_device_measure_data_history_${year} tdm" +
//            " left join t_classify_device_property tcdp ON tdm.device_id=tcdp.device_id" +
//            " WHERE" +
//            " tdm.measure_time BETWEEN #{start} " +
//            " AND #{end} " +
//            " AND tdm.device_id IN " +
//            " <foreach item='item' index='index' collection='deviceIds' open='(' separator=',' close=')'> #{item} </foreach> " +
//            " AND tdm.data_type_id = #{devicePropertyId} " +
//            "GROUP BY" +
//            " ${format}(tdm.measure_time)" +
//            "</script>")
//    List<DeviceMeasureDateDto> getSum(@Param("year") int year, @Param("start") LocalDateTime start, @Param("end") LocalDateTime end,
//                                      @Param("deviceIds") List<String> deviceIds, @Param("devicePropertyId") String devicePropertyId,
//                                      @Param("format") String format);
//
//}
